package domain;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

public class Auction {

	private String item;
	private String seller;
	private String bidder;
	private double bid;
	private Date date;
	private static int idcounter = 0;
	private final int id = idcounter;

	public Auction(String item, String seller, long duration) {
		this.item = item;
		this.seller = seller;
		this.bid = 0.0;
		this.date = new Date(new Date().getTime()+duration);
		idcounter++;

	}


	public String getItem() {
		return item;
	}



	public void setItem(String item) {
		this.item = item;
	}



	public String getSeller() {
		return seller;
	}



	public void setSeller(String seller) {
		this.seller = seller;
	}



	public String getBidder() {
		return bidder;
	}



	public void setBidder(String bidder) {
		this.bidder = bidder;
	}



	public double getBid() {
		return bid;
	}



	public void setBid(double bid) {
		this.bid = bid;
	}



	public Date getDate() {
		return date;
	}



	public void setDate(Date date) {
		this.date = date;
	}

	public String toString() {
		DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss z");
		String auction="";
		//1. 'Apple I' wozniak 10.10.2012 21:00 CET 10000.00 gates
		auction+=""+this.id+". '"+this.item+"' "+this.seller+" "+dateFormat.format(this.date)+" "+this.bid+" "+this.bidder;

		return auction;
	}


	public final int getId() {
		return this.id;
	}
}
